/************************************************************
 * Project Name         [Thinking_In_Java]
 * File Name            [Java_Util_EnumMap.java]
 * Creation Date        [20-Jun-2014]
 * 
 * Copyright© ge.y.yang@gmail.com All Rights Reserved
 * 
 * Work hard, play harder, think big and keep fit
 ************************************************************/
package pkg_api_testing;

import java.util.EnumMap;
import java.util.Map;

import pkg_02_oop.Size;

/**
 * java.util.EnumMap<K, V>
 * 
 * @author 不落的太阳(Sean Yang)
 * @version 1.0
 * @since JDK 6
 * 
 */
public class Java_Util_EnumMap {

	/**
	 * 测试方法
	 * 
	 * @param args
	 *            命令行参数
	 */
	public static void main(String[] args) {
		// 定义一个EnumMap
		Map<Size, String> enumMap = new EnumMap<Size, String>(Size.class);
		enumMap.put(Size.EXTRA_LARGE, "Extra large");
		enumMap.put(Size.LARGE, "Large");
		enumMap.put(Size.MEDIUM, "Medium");
		enumMap.put(Size.SMALL, "Small");

		// 遍历的结果的顺序取决于枚举类定义常量的顺序
		for (String value : enumMap.values()) {
			System.out.print(value + '\t');
		}
	}

}
